import './index.scss'
import React, { Component } from 'react'
import { connect } from 'react-redux'

@connect(({ toast }) => ({ toast }))
class Toast extends Component {
	render() {
		const { toast } = this.props
		const len = toast.length
		return (
			<div className="mod-toast">
				{toast.map((item, index) => {
					return len === index + 1 ? (
						<div key={item.id} className="mod-toast-text">
							{item.message}
						</div>
					) : null
				})}
			</div>
		)
	}
}

export default Toast
